<!DOCTYPE html>
<html>
<head>
    <title>快递鸟</title>
    <include file='public/head'>
    <style>
        .layui-legend-size{font-size:14px !important;}
        .layui-nopadding{padding:0 !important;}
        .layui-overflow{overflow:auto;}
        .layui-nomargin{margin: 0 !important;}
        .layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
        .layui-input{height:30px !important; }
        .layui-form-search-item .layui-inline{margin-bottom: 5px;} 
        .layui-form-search-item label{margin-left: 15px;}
        .layui-table-page {padding: 7px 0px 0px;}
        .layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
    </style>
</head>
<body>
    <!-- layui-tab开始 -->
    <div class="layui-tab" lay-fliter="demo-tab">
        <!-- 顶部导航菜单开始 -->
        <div class="layui-tab-nav">
            <ul class="layui-tab-title">
                {:getNav('logistics','logistics_kdniao/index')};
            </ul>
        </div>
        <!-- 顶部导航菜单结束 -->
        <br>
        

        <!-- 内容开始 -->
        <div class="layui-card">
            <!-- 表头按钮开始 -->
            <div class="layui-card-header layui-bg-gray layui-bottom">
                <a href="javascript:;" class="layui-btn layui-btn-xs  add-config-btn" >
                    <i class="layui-icon">&#xe620;</i>配置
                </a>
            </div>    
            <!-- 表头按钮结束 -->
            <div class="layui-card-body layui-nopadding " ></div>

                <!-- 搜索栏开始 -->
                <fieldset class="layui-elem-field layui-field-title layui-field-padding">
                    <legend class="layui-legend-size">快递查询</legend>
                    <form class="layui-form table-bar" action="{:cmf_plugin_url('Logistics://logistics_kdniao/index')}" lay-filter="form-bar" method="post">
                        <div class="layui-form-search-item">
                           
                            <div class="layui-inline" >
                                    <label>快递公司</label>
                                    <div class="layui-input-inline" style="width: 150px;">
                                        <select name="ShipperCode" class="layui-input" lay-verify="" lay-search="">
                                            <option value="">请选择</option> 
                                            <volist name="info" id="vo">
                                            <option value="{$vo.code}">{$vo.company}</option> 
                                            </volist>
                                            
                                        </select>
                                    </div>

                                <label>物流单号</label>
                                <div class="layui-input-inline" style="width: 150px;">
                                    <input type="text" name="LogisticCode" autocomplete="off" placeholder="请输入物流单号" class="layui-input"  style="width: 150px;">
                                </div>
                            </div>
                            
                            <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-sm layui-btn-primary " style="font-weight:800;" lay-submit="" lay-filter="demo2"><i class="layui-icon ">&#xe615;</i>搜索</button>
                            </div>
                          
                        </div>
                    </form>
                </fieldset>
                <!-- 搜索栏结束 -->

            <if condition="$msg['Success']==true">
                <b style="font-size: 24px;">搜索结果</b>
                <table class="layui-table layui-nomargin" style="width:700px;margin-top:20px">
                  <tbody>
                    <tr>
                      <th style="font-weight:800 ;" width="65">快递公司</th>
                      <td>{$msg.company}</td>
                    </tr>
                    <tr>
                      <th style="font-weight:800 ;" width="65">物流单号</th>
                      <td>{$msg.LogisticCode}</td>
                    </tr>
                    <tr>
                      <th style="font-weight:800 ;" width="65">物流状态</th>
                      <td>{$msg.State}</td>
                    </tr>
                    <tr>
                      <th style="font-weight:800 ;" width="65">物流跟踪</th>
                      <td style="text-align: left">
                        
                      <?php foreach($msg['Traces'] as $k => $r){?>
        
                      <ul class="layui-timeline">
                          <li class="layui-timeline-item">
                            <i class="layui-icon layui-timeline-axis"></i>
                            <div class="layui-timeline-content layui-text">
                              <h3 class="layui-timeline-title"><?php echo $r['AcceptTime'];?></h3>
                              <p><?php echo $r['AcceptStation'];?>
                              </p>
                            </div>
                          </li>
                        </ul>
                        
                      <?php }?>
                      </td>
                    </tr>
                  </tbody>
                </table>
            </if>
            <notempty name="$msg">
            <if condition="$msg['Success']==false">
                <b style="font-size: 24px;">返回错误</b>
                <table class="layui-table layui-nomargin" style="width:700px;margin-top:20px">
                  <tbody>
                    <tr>
                      <td>{$msg.Reason}请核实快递单号及快递鸟(用户ID、API key)、快递鸟是否开通查询业务(即时查询 仅支持三家 申通，圆通，中通，免费版本是不支持顺丰京东的查询)</td>
                    </tr>
                  </tbody>
                </table>
            </if>
            </notempty>

        </div>
        <!-- 内容结束 -->

    </div>
    <div id="id"> </div>
    <!-- layui-tab结束 -->
    <include file='public/scripts'>
     

    <script>


    //配置
    $('.add-config-btn').on('click',function(){
		let url = "{:cmf_plugin_url('logistics://logistics_kdniao/configPage')}";
		layer.open({
			type: 2//基本层类型  0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
			,title: '配置'//层的标题
			,shadeClose: true//是否点击遮罩关闭
			,shade: 0.8//遮罩
			,area: ['1000px', '800px']//宽高
			,btn:['提交','关闭']//弹框按钮
			,fixed:false//固定
			,content: url //iframe的url
			,yes:function(index, layero){
            //子页面的请求操作都放子页面
                var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                iframeWin.tijiao();
			}
			,btn2:function(index, layero){
			}
		});
    })
    
    </script>
</body>
</html>